<template>
	<view>
		<statusBar bgColor="#ffffff"></statusBar>
		<view class="userCard" @tap="toEdit" data-url="userInfo">
			<image :src="userInfo.pic?userInfo.pic:'../../static/userPic.png'"></image>
			<text class="userName">账号：{{userInfo.username?(userInfo.username.replace(userInfo.username.substring(3,7), "****")):'未登录'}}</text>
			<text class="iconfont icon-right"></text>
		</view>
		<view class="setList">
			<!-- <view class="row tapBg" @tap="toPage" data-url="settledProgress" v-if="userInfo.admin==1">
				<image src="../../static/settled.png"></image>
				<text class="setLabel">资质认证</text>
				<text class="iconfont icon-right"></text>
			</view> -->
			<view class="row tapBg" @tap="toPage" data-url="selectShop">
				<image src="../../static/toggle.png"></image>
				<text class="setLabel">切换店铺</text>
				<text class="iconfont icon-right"></text>
			</view>
			<view class="row tapBg" @tap="toPage" data-url="customerCenter">
				<image src="../../static/cusService.png"></image>
				<text class="setLabel">客服中心</text>
				<text class="iconfont icon-right"></text>
			</view>
			<view class="row tapBg" @tap="toPage" data-url="setting">
				<image src="../../static/setting.png"></image>
				<text class="setLabel">设置</text>
				<text class="iconfont icon-right"></text>
			</view>
		</view>
	</view>
</template>

<script>
	import statusBar from "../../components/statusBar/statusBar.vue";
	import COMM from "@/common/common.js";
	import {
		mapState,
		mapMutations,
		mapActions,
		mapGetters
	} from 'vuex'
	export default {
		components: {
			statusBar
		},
		computed: {
			...mapState({
				userInfo: state => state.user.userInfo,
			}),
		},
		data() {
			return {

			};
		},
		methods: {
			toEdit(e){
				if(this.userInfo.admin!=1){
					uni.showToast({
						title: '请联系商户管理至web端修改',
						icon: 'none'
					});
				}else{
					this.toPage(e)
				}
			}
		},
		onLoad() {
			if(uni.getStorageSync('token')){
				
			}else{
				uni.reLaunch({
				    url: '../login/login'
				});
			}

		},
		onPullDownRefresh() {
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1500)
		}
	}
</script>

<style lang="less">
	page {
		background-color: #f6f6f6;
	}

	.userCard {
		padding: 50upx 32upx;
		background-color: #FFFFFF;
		display: flex;
		align-items: center;

		image {
			width: 94upx;
			height: 94upx;
			border-radius: 50%;
			margin-right: 25upx;
		}

		.userName {
			font-size: 36rpx;
			font-weight: bold;
			color: #202932;
			flex: 1;
		}

		.iconfont {
			color: #202932;
			font-weight: bold;
		}

	}

	.setList {
		margin-top: 26upx;
		padding: 0 18upx;
		display: flex;
		flex-direction: column;

		.row {
			display: flex;
			align-items: center;
			background-color: #FFFFFF;
			padding: 40upx 35upx;
			border-radius: 16upx;
			box-shadow: 0rpx 3rpx 17rpx 0rpx rgba(201, 202, 208, 0.15);
			margin-bottom: 10upx;

			image {
				width: 50upx;
				height: 50upx;
				margin-right: 30upx;
			}

			.setLabel {
				font-size: 32rpx;
				font-weight: none;
				color: #908bad;
				flex: 1;
			}

			.iconfont {
				color: #908bad;
			}
		}
	}
</style>
